﻿<head>
<script type="text/javascript" src="/public/js/jquery-1.4.2.min.js"></script>
<link rel="stylesheet" type="text/css" href="/public/css/flexigrid/flexigrid/flexigrid.css">
<link rel="stylesheet" media="screen" type="text/css" href="/public/css/admin/category/style.css" />
<link rel="stylesheet" href="/public/css/admin/category/nyroModal-1.3.0/styles/nyroModal.css" type="text/css" media="screen" />
<script type="text/javascript" src="/public/js/jquery-1.2.6.pack.js"></script>
<script type="text/javascript" src="/public/js/jquery.simple.tree.js"></script>
<script src="/public/css/admin/category/nyroModal-1.3.0/js/jquery.nyroModal-1.3.0.pack.js"></script> 
<script type="text/javascript" src="/public/js/flexigrid.js"></script>
<script type="text/javascript">   
	$(document).ready(function(){ 
		$("#table1").flexigrid(
		{
			colModel : [
				{display: 'Edit', name : 'edit', width : 40, sortable : true, align: 'center'},
				{display: 'Nhà sản xuất', name : 'nhasanxuat', width : 180, sortable : true, align: 'left'},
				{display: 'Xuất xứ', name : 'xuatxu', width : 120, sortable : true, align: 'left'},
				{display: 'Trang chủ', name : 'link', width : 130, sortable : true, align: 'left'},
				{display: 'Avatar', name : 'avatar', width : 80, sortable : true, align: 'right'}
				],
			buttons : [
				{name: 'Add', bclass: 'add',onpress : test},
				{name: 'Delete', bclass: 'delete',onpress : test},
				{separator: true}
				],
			title:'Nhà cung cấp',
			singleSelect: true,
			width:700,
			height:200,
		}
		);
			
		function test(com,grid) 
			{
				if (com=='Delete')
					{
						confirm('Delete ' + $('.trSelected',grid).length + ' items?')
					}
				else if (com=='Add')
					{
						//alert('Add New Item');
						$.nyroModalManual({
							url: 'http://shoppingcartcnpm.orgfree.com/index.php/Longadmin/admin/add',
							width: 500, // default Width If null, will be calculate automatically
							height: 500, // default Height If null, will be calculate automatically
							minWidth: null, // Minimum width
							minHeight: null, // Minimum height
							endRemove: function() {window.location.reload()}
						});	
					}			
			}
			

	});	
</script>
</head>
<?php 
	$db = Zend_Registry::get('db');
	$table = 'supplier';
	$select = $db->select()->from($table);
	$suppliers = $db->query($select)->fetchAll();
?>

 
<table id="table1">
 <tbody>
	<?php echo $this->partialLoop('admin/_supplier.phtml',$suppliers); ?>
 </tbody>
</table>	


<style>
	
	.flexigrid div.fbutton .add
		{
			background: url(/public/css/flexigrid/images/add.png) no-repeat center left;
		}	

	.flexigrid div.fbutton .delete
		{
			background: url(/public/css/flexigrid/images/close.png) no-repeat center left;
		}	

</style>